package com.zjp.mall.util;

import org.bouncycastle.util.encoders.Base64;

import java.security.InvalidAlgorithmParameterException;

public class Test {

    public static void main(String[] args) throws InvalidAlgorithmParameterException {
        String code = "0112efCt0o9vob1wd1Et0lUOBt02efCZ";
        String encryptedData = "om9gMZ9k27ciyBcL2GTpJ6NRR/gjjVhdl4EGpp/WztIJ88yQ/Ap6f4YEJFkq2Ie9Wc5IhlX8hZygDcZw8OVxxAp5ry9BIkZINByoCUZPyMJu1Yx6RYjNCbLxgUqSEKwErIjpcNkLRH/6zyziG4ZwFAZ0LT6Co0j+HSRwC1iLmmUceqvpegYLluLB+tupfWId47OfXKW2f/7I85JVn6u4wU3NpWTXP5p+0OQhf/3gFEbIdOUEXmkmol8rYOsVHUtQExOIouJR09M3YchJvyUtST2F8IfltC/7f2bsDE93DPapsnNcXPktCO7xmrLTp6CJ61/6yzMhSVjj86jAB95WqeNVglFb0dQ+5GoBRt8CUO1u4Qon1Lwce2X81hufQIeAZ48E9u4oAqTXrw7B71RMRst5Fv+ai/9D933VYxpgKp49hwe6BSHCb45+lIEXH7nPoZ41oZQl0LZYGI5EqlfKG6LZXS9mFOB2DpjTLLE9OVFMOoTLp3orDpwKs2Y4kM1McvtvhSLsbwG7S9f1dPv6FJaJQwmmohaoNi1AyNntIJJYDt8Q4a6/lwZc+70gDkBI";
        String session_key = "m+6UPeTTtYkRNL9W4sby6Q==";
        String signature = "9f44f892eb7bc9e2fd166e17b05edfb53ae9edad";
        String iv = "RQKLdeSpTrhPHryXHE7ogg==";

        byte[] aaa = AESUtil.instance.decrypt(Base64.decode(encryptedData),Base64.decode(session_key),Base64.decode(iv));
        System.out.println(new String(aaa));

        String rowData = "{\"nickName\":\"蜗牛、剩下都是凑字数嘀、我勒个去居然没限制、霸气～\",\"gender\":1,\"language\":\"zh_CN\",\"city\":\"Qinhuangdao\",\"province\":\"Hebei\",\"country\":\"China\",\"avatarUrl\":\"https://wx.qlogo.cn/mmopen/vi_32/DYAIOgq83eoia1YggGbZLvQpgIywKHiaKScCI7nFSobibjY0w988lragvibKdYxUvdQWpbDrlMQtUxCUEJVRkWwLvw/0\"}";
        System.out.println(WechatDecrypt.checkSignature(signature,session_key,rowData));
    }
}
